package com.myHospital.biz.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Service;

import com.myHospital.biz.AppointmentTimeBiz;
import com.myHospital.biz.DepartmentsBiz;
import com.myHospital.biz.HospitalBiz;
import com.myHospital.dao.AppointmentTimeDao;
import com.myHospital.dao.HospitalDao;
import com.myHospital.entity.AppointmentTime;
import com.myHospital.entity.Departments;
import com.myHospital.entity.Hospital;

@Service("hospitalBiz")
public class HospitalBizImpl implements HospitalBiz {
	@Autowired
	private HospitalDao hospitalDao;
	
	public List<Hospital> getAll() {
		return hospitalDao.getAll();
	}

	@Override
	public List<Hospital> searchHospital(String site) {
		return hospitalDao.searchHospital(site);
	}

	@Override
	public Hospital getById(int id) {
		return hospitalDao.getById(id);
	}

	@Override
	public int update(Hospital hospital) {
		return hospitalDao.update(hospital);
	}

	@Override
	public int delete(int id) {
		return hospitalDao.delete(id);
	}


	public static void main(String[] args) {
		ApplicationContext context=new ClassPathXmlApplicationContext("beans.xml");
		AppointmentTimeBiz appointmentTimeBiz=(AppointmentTimeBiz) context.getBean("appointmentTimeBiz");
		DepartmentsBiz departmentsBiz=(DepartmentsBiz) context.getBean("departmentsBiz");
		HospitalBiz hospitalBiz=(HospitalBiz) context.getBean("hospitalBiz");
		List<Departments> list =departmentsBiz.getByDetailId(0, 5);
		for (Departments departments : list) {
			System.out.println(departments.getName());
		}
		
	}

}
